package com.example.basicknowledge.ViewPager_Fragment;

import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;

import com.example.basicknowledge.R;

public class ViewPagerActivity extends AppCompatActivity implements BlankFragmentOne.OnFragmentInteractionListener{
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view_pager_activity);
//        getSupportFragmentManager().beginTransaction().replace(R.id.container,new BlankFragmentOne()).commit();

        ViewPager viewPager = (ViewPager)findViewById(R.id.viewpager);
        CategoryAdapter adapter = new CategoryAdapter(getSupportFragmentManager());
        viewPager.setAdapter(adapter);

        TabLayout tabLayout = (TabLayout)findViewById(R.id.tabs);
        tabLayout.setupWithViewPager(viewPager);
    }

    @Override
    public void onFragmentInteraction(Uri uri) {

    }

    public void test_on_click(View view) {
        Toast.makeText(this,"点击了测试按钮在activity中",Toast.LENGTH_SHORT).show();
    }
}
